<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
  .box {
    width: 200px;
    height: 200px;
    background: #ccc;
    border: 1px solid black;
  }
  </style>
  <script src="./angular.js"></script>
  <script>
    let mod = angular.module('mod1', [], );

    mod.controller('ctrl1', function($scope, $interval) {
      $scope.arr = [
        {name: "tim", mobile: 18754236981},
        {name: "jack", brith: 15549781658},
        {name: "tom", brith: 13963589764},
      ]


    });
    // 手机号中间四位变成星号
    mod.filter('a', function() {
      // return 的函数才是filter真正的函数
      // 参数1：输入的值，也就是数据未经过滤的值。参数2：给过滤器传的值
      return function (input, arg) {
        return input.substring(0,3) + '****' + input.substring(7)
      }
    });
  </script>
</head>
<body ng-app="mod1">
  <div ng-controller="ctrl1">
    <ul>
      <li ng-repeat="json in arr">
        {{json.name}}, {{json.mobile|a}}
      </li>
    </ul>
  </div>
</body>

</html>
